package com.eshop.enums;

import java.util.stream.Stream;

public enum BillEnum
{
    PM_0(Integer.valueOf(0), "支出"), 
    PM_1(Integer.valueOf(1), "获得"), 
    STATUS_0(Integer.valueOf(0), "默认"), 
    STATUS_1(Integer.valueOf(1), "有效"), 
    STATUS_2(Integer.valueOf(2), "无效");
    
    private Integer value;
    private String desc;
    
    public static BillEnum toType(final int value) {
        return Stream.of(values()).filter(p -> p.value == value).findAny().orElse(null);
    }
    
    public Integer getValue() {
        return this.value;
    }
    
    public String getDesc() {
        return this.desc;
    }
    
    private BillEnum(final Integer value, final String desc) {
        this.value = value;
        this.desc = desc;
    }
}
